package com.shdanyan.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.cache.annotation.CacheConfig;

import com.shdanyan.domain.sys.SysUserInfo;
import com.shdanyan.utils.MyMapper;

@CacheConfig(cacheNames = "users")
@Mapper
public interface SysUserInfoMapper extends MyMapper<SysUserInfo> {

    @Select("SELECT * FROM sys_user_info WHERE username = #{username}")
    SysUserInfo findByUsername(@Param("username") String username);

    @Select("SELECT * FROM sys_user_info WHERE id = #{id}")
    SysUserInfo selectById(@Param("id") Long id);

    /*
     * 
     * @Cacheable(key = "#p0", condition = "#p0.length() < 10")
     * 
     * @Select("SELECT * FROM user WHERE name = #{name}") User
     * findByName(@Param("name") String name);
     * 
     * @Insert("INSERT INTO user(name, age) VALUES(#{name}, #{age})") int
     * insert(@Param("name") String name, @Param("age") Integer age);
     * 
     * @Update("UPDATE user SET age=#{age} WHERE name=#{name}") void update(User
     * user);
     * 
     * @Delete("DELETE FROM user WHERE id =#{id}") void delete(Long id);
     * 
     * @Insert("INSERT INTO user(name, age) VALUES(#{name}, #{age})") int
     * insertByUser(User user);
     * 
     * @Insert("INSERT INTO user(name, age) VALUES(#{name,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})"
     * ) int insertByMap(Map<String, Object> map);
     * 
     * @Results({ @Result(property = "name", column = "name"),
     * 
     * @Result(property = "age", column = "age") })
     * 
     * @Select("SELECT id,name, age FROM user") List<User> getAllUser();
     * 
     */}